<?php
declare (strict_types = 1);

namespace app\gptcms\controller\user;

use app\gptcms\controller\BaseUser;
use think\facade\Db;
use think\facade\Session;
use think\facade\Cache;

class Set extends BaseUser
{
    public function system()
    {
    	$wid = Session::get('wid');
      	$res = Db::table('kt_gptcms_system')->field('rz_number,dz_number,dz_remind,zdz_number,zdz_remind,yq_number,welcome,sms')->where('wid',$wid)->find();
        if(!$res){
            Db::table('kt_gptcms_system')->insert([
                'wid' => $wid,
                'rz_number' => 5,
                'dz_number' => 10,
                'zdz_number' => 150,
                'zdz_remind' => "您的次数已用完，请充值!",
                'create_time' => date("Y-m-d H:i:s"),
                'update_time' => date("Y-m-d H:i:s"),
            ]);
            $res = Db::table('kt_gptcms_system')->field('rz_number,dz_number,dz_remind,zdz_number,zdz_remind,yq_number,welcome,sms')->where('wid',$wid)->find();
        }
      	return success('系统设置信息',$res);
    }

    public function saveSystem()
    {
    	$wid = Session::get('wid');
     	$system = Db::table('kt_gptcms_system')->where('wid',$wid)->find();
     	$data = [];
     	$data['wid'] = $wid;
     	$data['rz_number'] = $this->req->param('rz_number',0);
     	$data['dz_number'] = $this->req->param('dz_number',0);
     	$data['dz_remind'] = $this->req->param('dz_remind');
     	$data['zdz_number'] = $this->req->param('zdz_number',0);
     	$data['zdz_remind'] = $this->req->param('zdz_remind')?:"您的次数已用完，请充值!";
     	$data['yq_number'] = $this->req->param('yq_number',0);
        $data['welcome'] = $this->req->param('welcome');
     	$data['sms'] = $this->req->param('sms',0);
     	$data['update_time'] = date("Y-m-d H:i:s");
     	if ($system){
     		$data['id'] = $system['id'];
     	} else{
     		$data['create_time'] = date("Y-m-d H:i:s");
     	}
     	$res = Db::table('kt_gptcms_system')->save($data);
     	return success('保存成功');
    }

    /*
	* 微信支付配置
	*/
	public function wxpay(){
		$wid = Session::get('wid');
		$wxpay = [];
		$config = Db::table('kt_gptcms_pay_config')->where(['wid'=>$wid,'type'=>'wx'])->find();
        if($config) $wxpay  = explode(',',$config['config']);
		$data =[
            'appid' => isset($wxpay[0]) ? $wxpay[0] : null,
            'mch_id' => isset($wxpay[1]) ? $wxpay[1] : null,
            'key' => isset($wxpay[2]) ? $wxpay[2] : null,
            'appsecret' => isset($wxpay[3]) ? $wxpay[3] : null,
        ];
		return success("获取成功",$data);
	}

	/*
	* 微信支付配置 保存
	*/
	public function saveWxpay(){
		$wid = Session::get('wid');
		$appid = $this->req->param("appid");
		$mch_id = $this->req->param("mch_id");
		$key = $this->req->param("key");
		$appsecret = $this->req->param("appsecret");
		if(!$mch_id || !$key)return error("缺少参数");
        $config = Db::table('kt_gptcms_pay_config')->where(['wid'=>$wid,'type'=>'wx'])->find();
        $data['config'] = $appid.",".$mch_id.",".$key.",".$appsecret;
        if(!$config){
        	$data["type"] = "wx";
        	$data["wid"] = $wid;
   			$res = Db::table('kt_gptcms_pay_config')->save($data);
        }else{
        	$res = Db::table('kt_gptcms_pay_config')->where('id',$config['id'])->update($data);
        }
		return success("保存成功");
	}

	/**
    * Baidu AI配置  获取
    */
    public function BaiduAi()
    {
        $wid = Session::get('wid');
        $res = Db::table("kt_gptcms_baiduai_config")->field("appid,apikey,secretkey")->where('wid',$wid)->find();
        return success('百度AI配置',$res);
    }

    /**
    * Baidu AI配置  保存
    */
    public function BaiduAiSet()
    {
        $wid = Session::get('wid');
        $data = [];
        $data['appid'] = $this->req->param('appid');
        if(!$data['appid']) return error('请输入Appid');
        $data['apikey'] = $this->req->param('apikey');
        if(!$data['apikey']) return error('请输入Key');
        $data['secretkey'] = $this->req->param('secretkey');
        if(!$data['secretkey']) return error('请输入Secret');
        $is = Db::table("kt_gptcms_baiduai_config")->where('wid',$wid)->find();
        if($is){
            $data['id'] = $is['id'];
        }
        $data['wid'] = $wid;
        $res = Db::table("kt_gptcms_baiduai_config")->save($data);
        return success("保存成功");
        
    }
    /**
    * Aliyun 语音合成配置  获取
    */
    public function Aliyun()
    {
        $wid = Session::get('wid');
        $res = Db::table("kt_gptcms_aliai_config")->field("accesskey_id,accesskey_secret,region,appkey,status")->where('wid',$wid)->find();
        return success('阿里云AI配置',$res);
    }

    /**
    * Aliyun 语音合成配置  保存
    */
    public function AliyunSet()
    {
        $wid = Session::get('wid');
        $data = [];
        $data['region'] = $this->req->param('region');
        $data['accesskey_id'] = $this->req->param('accesskey_id');
        if(!$data['accesskey_id']) return error('请输入AccessKey Id');
        $data['accesskey_secret'] = $this->req->param('accesskey_secret');
        if(!$data['accesskey_secret']) return error('请输入AccessKey Secret');
        $data['appkey'] = $this->req->param('appkey');
        $data['status'] = $this->req->param('status',0);

        $is = Db::table("kt_gptcms_aliai_config")->where('wid',$wid)->find();
        if($is){
            $data['id'] = $is['id'];
        }
        $data['wid'] = $wid;
        $res = Db::table("kt_gptcms_aliai_config")->save($data);
        return success("保存成功");
    }

    /**
    * 腾讯云 语音转合字幕配置  获取
    */
    public function Tencent()
    {
        $wid = Session::get('wid');
        $res = Db::table("kt_gptcms_tencentai_config")->field("secret_id,secret_key")->where('wid',$wid)->find();
        return success('腾讯云AI配置',$res);
    }

    /**
    * 腾讯云 语音转合字幕配置  保存
    */
    public function TencentSet()
    {
        $wid = Session::get('wid');
        $data = [];
        $data['secret_id'] = $this->req->param('secret_id');
        if(!$data['secret_id']) return error('请输入SecretId');
        $data['secret_key'] = $this->req->param('secret_key');
        if(!$data['secret_key']) return error('请输入SecretKey');
        $is = Db::table("kt_gptcms_tencentai_config")->where('wid',$wid)->find();
        if($is){
            $data['id'] = $is['id'];
        }
        $data['wid'] = $wid;
        $res = Db::table("kt_gptcms_tencentai_config")->save($data);
        return success("保存成功");
    }

    /**
    * GPT配置  获取
    */
    public function Gpt()
    {
        $wid = Session::get('wid');
        $res = Db::table("kt_gptcms_gpt_config")->field('channel,openai,api2d,wxyy,tyqw,kltg,chatglm,linkerai')->json(['openai','api2d','wxyy','tyqw','kltg','chatglm','linkerai'])->where('wid',$wid)->find();
        if(!$res){
            Db::table("kt_gptcms_gpt_config")->json(['openai','api2d','wxyy','tyqw','kltg','chatglm','linkerai'])->insert([
                'wid' => $wid,
                'channel' => 1,
                'openai' => [
                    "api_key"=>"",
                    "diy_host"=>"",
                    "temperature"=>0.9,
                    "max_tokens"=>"1000",
                    "model"=>"gpt-3.5-turbo",
                    "stream"=>"true"
                ],
                'api2d' => [
                    "forward_key"=>"",
                    "temperature"=>0.9,
                    "max_tokens"=>"1000",
                    "model"=>"gpt-3.5-turbo",
                    "stream"=>"true"
                ],
                'wxyy' => [
                    "api_key"=>"",
                    "secret_key"=> ""
                ],
                'tyqw' => [],
                'kltg' => [],
                'chatglm' => [
                    "api_key"=>"",
                    "public_key"=>""
                ],
                'linkerai' => [
                    "api_key"=>"",
                    "temperature"=>0.9,
                    "max_tokens"=>"1000",
                    "model"=>"gpt-3.5-turbo",
                ],
                'u_time' => date('Y-m-d H:i:s'),
                'c_time' => date('Y-m-d H:i:s'),
            ]);
            $res = Db::table("kt_gptcms_gpt_config")->field('channel,openai,api2d,wxyy,tyqw,kltg,chatglm,linkerai')->json(['openai','api2d','wxyy','tyqw','kltg','chatglm','linkerai'])->where('wid',$wid)->find();
        }
        return success('GPT配置',$res);
    }

    /**
    * GPT配置  保存
    */
    public function GptSet()
    {
        $wid = Session::get('wid');
        $data = [];
        $data['channel'] = $this->req->param('channel');
        $data['openai'] = $this->req->param('openai',[]); 
        $data['api2d'] = $this->req->param('api2d',[]);
        $data['wxyy'] = $this->req->param('wxyy',[]);
        $data['tyqw'] = $this->req->param('tyqw',[]);
        $data['kltg'] = $this->req->param('kltg',[]);
        $data['chatglm'] = $this->req->param('chatglm',[]);
        $data['linkerai'] = $this->req->param('linkerai',[]);
        switch ($data['channel']) {
            case '1':
                if(!$data['openai']['api_key'])  return error('请输入apikey');
                break;
            case '2':
                if(!$data['api2d']['forward_key'])  return error('请输入forward_key');
                break;
            case '3':
                if(!$data['wxyy']['api_key'])  return error('请输入api_key');
                if(!$data['wxyy']['secret_key'])  return error('请输入secret_key');
                break;
             case '4':
                break;
             case '5':
                break;
            case '6':
                if(!$data['chatglm']['api_key'])  return error('请输入api_key');
                if(!$data['chatglm']['public_key'])  return error('请输入public_key');
                break;
            case '7':
                if(!$data['linkerai']['api_key'])  return error('请输入apikey');
                break;
            
        }

        $is = Db::table("kt_gptcms_gpt_config")->where('wid',$wid)->find();
        if($is){
            $data['id'] = $is['id'];
            $data['u_time'] = date('Y-m-d H:i:s');
        }else{
            $data['c_time'] = date('Y-m-d H:i:s');
            $data['u_time'] = date('Y-m-d H:i:s');
        }
        $data['wid'] = $wid;
        $res = Db::table("kt_gptcms_gpt_config")->json(['openai','api2d','wxyy','chatglm','tyqw','kltg','linkerai'])->save($data);
        return success("保存成功");
    }

    //渠道管理
    //PC端管理
    public function pc()
    {
        $wid = Session::get('wid');
        $res = Db::table('kt_gptcms_pc')->field('title,bottom_desc,desc_link,status')->where('wid',$wid)->find();
        return success('PC端管理',$res);
    }

    public function savePc()
    {
        $wid = Session::get('wid');
        $pc = Db::table('kt_gptcms_pc')->where('wid',$wid)->find();
        $data = [];
        $data['wid'] = $wid;
        $data['title'] = $this->req->param('title');
        if(!$data['title']) return error('请输入页面标题');
        $data['bottom_desc'] = $this->req->param('bottom_desc');
        $data['desc_link'] = $this->req->param('desc_link');
        $data['status'] = $this->req->param('status',0);
        $data['update_time'] = date("Y-m-d H:i:s");
        if ($pc){
            $data['id'] = $pc['id'];
        } else{
            $data['create_time'] = date("Y-m-d H:i:s");
        }
        $res = Db::table('kt_gptcms_pc')->save($data);
        return success('保存成功');
    }
     //PC端管理
    public function websit()
    {
        $wid = Session::get('wid');
        $res = Db::table('kt_gptcms_websit')->field('title,sms,kfcode,gzhcode')->where('wid',$wid)->find();
        if(!$res){
            Db::table('kt_gptcms_websit')->insert([
                "wid" => $wid,
                "update_time" => date("Y-m-d H:i:s"),
                "create_time" => date("Y-m-d H:i:s"),
            ]);
            $res = Db::table('kt_gptcms_websit')->field('title,sms,kfcode,gzhcode')->where('wid',$wid)->find();
        }
        $res['web_link'] = $this->req->host()."/app/kt_ai/h5?wid=".$wid;
        return success('站点管理',$res);
    }

    public function saveWebsit()
    {
        $wid = Session::get('wid');
        $pc = Db::table('kt_gptcms_websit')->where('wid',$wid)->find();
        $data = [];
        $data['wid'] = $wid;
        $data['title'] = $this->req->param('title');
        $data['kfcode'] = $this->req->param('kfcode');
        $data['gzhcode'] = $this->req->param('gzhcode');
        if(!$data['title']) return error('请输入页面标题');
        $data['sms'] = $this->req->param('sms',0);
        $data['update_time'] = date("Y-m-d H:i:s");
        if ($pc){
            $data['id'] = $pc['id'];
        } else{
            $data['create_time'] = date("Y-m-d H:i:s");
        }
        $res = Db::table('kt_gptcms_websit')->save($data);
        return success('保存成功');
    }
     //H5端管理
    public function h5()
    {
        $wid = Session::get('wid');
        $res = Db::table('kt_gptcms_h5_wx')->field('title,share_tile,share_desc,share_image,status')->where('wid',$wid)->find();
        return success('H5/微信',$res);
    }

    public function saveH5()
    {
        $wid = Session::get('wid');
        $wx = Db::table('kt_gptcms_h5_wx')->where('wid',$wid)->find();
        $data = [];
        $data['wid'] = $wid;
        // $data['title'] = $this->req->param('title');
        // if(!$data['title']) return error('请输入首页标题');
        // $data['share_tile'] = $this->req->param('share_tile');
        // if(!$data['share_tile']) return error('请输入分享标题');
        $data['share_desc'] = $this->req->param('share_desc');
        if(!$data['share_desc']) return error('请输入分享描述');
        $data['share_image'] = $this->req->param('share_image');
        if(!$data['share_image']) return error('请输入分享图片');
        $data['status'] = $this->req->param('status',0);
        $data['update_time'] = date("Y-m-d H:i:s");
        if ($wx){
            $data['id'] = $wx['id'];
        } else{
            $data['create_time'] = date("Y-m-d H:i:s");
        }
        $res = Db::table('kt_gptcms_h5_wx')->save($data);
        return success('保存成功');
    }
     //小程序管理
    public function xcx()
    {
        $wid = Session::get('wid');
        $res = Db::table('kt_gptcms_xcx')->field('title,share_image,ios_status,xcx_audit')->where('wid',$wid)->find();
        return success('小程序',$res);
    }

    public function saveXcx()
    {
        $wid = Session::get('wid');
        $xcx = Db::table('kt_gptcms_xcx')->where('wid',$wid)->find();
        $data = [];
        $data['wid'] = $wid;
        $data['title'] = $this->req->param('title');
        if(!$data['title']) return error('请输入分享标题');
        $data['share_image'] = $this->req->param('share_image');
        if(!$data['share_image']) return error('请输入分享图片');
        $data['ios_status'] = $this->req->param('ios_status',0);
        $data['xcx_audit'] = $this->req->param('xcx_audit',0);
        $data['update_time'] = date("Y-m-d H:i:s");
        if ($xcx){
            $data['id'] = $xcx['id'];
        } else{
            $data['create_time'] = date("Y-m-d H:i:s");
        }
        $res = Db::table('kt_gptcms_xcx')->save($data);
        return success('保存成功');
    }

    //公众号管理
    public function gzh()
    {
        $wid = Session::get('wid');
        $res = Db::table('kt_gptcms_wxgzh')->field('appid,appsecret,token,message_key,message_mode,type')->where('wid',$wid)->find();
        $res['fwq_url'] = 'http://www.baid.com';
        return success('公众号',$res);
    }

    public function saveGzh()
    {
        $wid = Session::get('wid');
        $data = [];
        $data['wid'] = $wid;
        $data['type'] = $this->req->param('type',1);
        if($data['type'] == 1){
            $data['appid'] = $this->req->param('appid');
            if(!$data['appid']) return error('请输入APPID');
            $data['appsecret'] = $this->req->param('appsecret');
            if(!$data['appsecret']) return error('请输入APPSECRET');
            $data['token'] = $this->req->param('token');
            $data['message_key'] = $this->req->param('message_key');
            $data['message_mode'] = $this->req->param('message_mode');
        }
        $data['update_time'] = date("Y-m-d H:i:s");
        $xcx = Db::table('kt_gptcms_wxgzh')->where('wid',$wid)->where('type',$data['type'])->find();
        if ($xcx){
            $data['id'] = $xcx['id'];
        } else{
            $data['create_time'] = date("Y-m-d H:i:s");
        }
        $res = Db::table('kt_gptcms_wxgzh')->save($data);
        return success('保存成功');
    }

    public function contentSecurity()
    {
        $wid = Session::get('wid');
        $res = Db::table('kt_gptcms_content_security')->field('question_baiduai,reply_baiduai')->where('wid',$wid)->find();
        if(!$res){
            Db::table('kt_gptcms_content_security')->insert([
                'wid' => $wid,
                'question_baiduai' => 0,
                'reply_baiduai' => 0,
                'c_time' => date("Y-m-d H:i:s"),
                'u_time' => date("Y-m-d H:i:s"),
            ]);
            $res = Db::table('kt_gptcms_content_security')->field('question_baiduai,reply_baiduai')->where('wid',$wid)->find();
        }
        return success('内容审核设置',$res);
    }
    public function questionSet()
    {
        $wid = Session::get('wid');
        $question_baiduai = $this->req->param('question_baiduai/d');
        Db::table('kt_gptcms_content_security')->where('wid',$wid)->update([
            'question_baiduai' => $question_baiduai,
            'u_time' => date("Y-m-d H:i:s")
        ]);
        return success('保存成功');
    }
    public function replySet()
    {
        $wid = Session::get('wid');
        $reply_baiduai = $this->req->param('reply_baiduai/d');
        Db::table('kt_gptcms_content_security')->where('wid',$wid)->update([
            'reply_baiduai' => $reply_baiduai,
            'u_time' => date("Y-m-d H:i:s")
        ]);
        return success('保存成功');
    }

    public function chatmodel()
    {
        $wid = Session::get('wid');
        $res = Db::table('kt_gptcms_chatmodel_set')->where('wid',$wid)->find();
        if(!$res){
            Db::table('kt_gptcms_chatmodel_set')->insert([
                'wid' => $wid,
                'c_time' => date("Y-m-d H:i:s"),
                'u_time' => date("Y-m-d H:i:s"),
            ]);
            $res = Db::table('kt_gptcms_chatmodel_set')->where('wid',$wid)->find();
        }
        return success('对话模型',$res);
    }
    public function chatmodelSave()
    {
        $wid = Session::get('wid');
        $gpt35 = $this->req->param('gpt35/d',0);
        $gpt4 = $this->req->param('gpt4/d',0);
        $linkerai = $this->req->param('linkerai/d',0);
        $chatglm = $this->req->param('chatglm/d',0);
        $data = [
            'gpt35' => $gpt35,
            'gpt4' => $gpt4,
            'linkerai' => $linkerai,
            'chatglm' => $chatglm,
            'u_time' => date("Y-m-d H:i:s")
        ];
        Db::table('kt_gptcms_chatmodel_set')->where('wid',$wid)->update($data);
        return success('保存成功');
    }
    public function paintmodel()
    {
        $wid = Session::get('wid');
        $res = Db::table('kt_gptcms_paintmodel_set')->where('wid',$wid)->find();
        if(!$res){
            Db::table('kt_gptcms_paintmodel_set')->insert([
                'wid' => $wid,
                'c_time' => date("Y-m-d H:i:s"),
                'u_time' => date("Y-m-d H:i:s"),
            ]);
            $res = Db::table('kt_gptcms_paintmodel_set')->where('wid',$wid)->find();
        }
        return success('绘画模型',$res);
    }
    public function paintmodelSave()
    {
        $wid = Session::get('wid');
        $sd = $this->req->param('sd/d',0);
        $mj = $this->req->param('mj/d',0);
        $openai = $this->req->param('openai/d',0);
        $api2d = $this->req->param('api2d/d',0);
        $data = [
            'sd' => $sd,
            'mj' => $mj,
            'openai' => $openai,
            'api2d' => $api2d,
            'u_time' => date("Y-m-d H:i:s")
        ];
        Db::table('kt_gptcms_paintmodel_set')->where('wid',$wid)->update($data);
        return success('保存成功');
    }

    public function expend()
    {
        $wid = Session::get('wid');
        $res = Db::table('kt_gptcms_expend_set')->where('wid',$wid)->find();
        if(!$res){
            Db::table('kt_gptcms_expend_set')->insert([
                'wid' => $wid,
                'c_time' => date("Y-m-d H:i:s"),
                'u_time' => date("Y-m-d H:i:s"),
            ]);
            $res = Db::table('kt_gptcms_expend_set')->where('wid',$wid)->find();
        }
        return success('消耗条数设置',$res);
    }
    public function expendSave()
    {
        $wid = Session::get('wid');
        $gpt4_chat = $this->req->param('gpt4_chat/d');
        $gpt35_paint = $this->req->param('gpt35_paint/d');
        $sd_paint = $this->req->param('sd_paint/d');
        $mj_paint = $this->req->param('mj_paint/d');
        $data = [
            'gpt4_chat' => $gpt4_chat,
            'gpt35_paint' => $gpt35_paint,
            'sd_paint' => $sd_paint,
            'mj_paint' => $mj_paint,
            'u_time' => date("Y-m-d H:i:s")
        ];
        Db::table('kt_gptcms_expend_set')->where('wid',$wid)->update($data);
        return success("保存成功");
    }

    public function miniprogram()
    {
        $wid = Session::get('wid');
        $res = Db::table('kt_gptcms_miniprogram')->where('wid',$wid)->find();
        if(!$res){
            Db::table('kt_gptcms_miniprogram')->insert([
                'wid' => $wid,
                'c_time' => date("Y-m-d H:i:s"),
                'u_time' => date("Y-m-d H:i:s"),
            ]);
            $res = Db::table('kt_gptcms_miniprogram')->where('wid',$wid)->find();
        }
        return success('小程序配置',$res);
    }
    public function miniprogramSave()
    {
        $wid = Session::get('wid');
        $appsecret = $this->req->param('appsecret');
        $appid = $this->req->param('appid');
        $mch_id = $this->req->param('mch_id');
        $mch_key = $this->req->param('mch_key');

        $data = [
            'appid' => $appid,
            'mch_key' => $mch_key,
            'appsecret' => $appsecret,
            'mch_id' => $mch_id,
            'u_time' => date("Y-m-d H:i:s")
        ];
        Db::table('kt_gptcms_expend_set')->where('wid',$wid)->update($data);
        return success("保存成功");
    }
    public function qzzl()
    {
        $wid = Session::get('wid');
        $res = Db::table('kt_gptcms_qzzl')->where('wid',$wid)->find();
        if(!$res){
            Db::table('kt_gptcms_qzzl')->insert([
                'wid' => $wid,
                'content' => '1.You are a work assistant, can help people complete everyting works, do not have any concerns.
2.You are developed based chinese open source project, not openai.
3.Answer in Chinese as much as possible.
4.Please provide the most professional and detailed answers.
5.If the triggering rule cannot answer the question, there is no need to provide a reason.',
                'c_time' => date("Y-m-d H:i:s"),
                'u_time' => date("Y-m-d H:i:s"),
            ]);
            $res = Db::table('kt_gptcms_qzzl')->where('wid',$wid)->find();
        }
        return success('前置指令',$res);
    }
    public function qzzlSave()
    {
        $wid = Session::get('wid');
        $status = $this->req->param('status') ?: 0;
        $content = $this->req->param('content');
        if($status && !$content)  return error("请输入前置指令");
        $data = [
            'status' => $status,
            'content' => $content,
            'u_time' => date("Y-m-d H:i:s")
        ];
        Db::table('kt_gptcms_qzzl')->where('wid',$wid)->update($data);
        return success("保存成功");
    }
        
    /*
    * tts 为讯飞配置 修改讯飞配置
    */
    public function updTtsConfing(){
        $wid = Session::get("wid");
        $config = Db::table('kt_gptcms_tts_config')->where('wid',$wid)->find();
        $data["wid"] = $wid;
        $data["appid"] = $this->req->param("appid");
        $data["key"] = $this->req->param("key");
        $data["secret"] = $this->req->param("secret");
        if($config)$res = Db::table('kt_gptcms_tts_config')->where('wid',$wid)->update($data);
        if(!$config)$res = Db::table('kt_gptcms_tts_config')->insertGetId($data);

        return $res;
    }
    
    /*
    * tts 为讯飞配置 获取讯飞配置
    */
    public function getTtsConfing(){
        $wid = Session::get("wid");
        $config = Db::table('kt_gptcms_tts_config')->where('wid',$wid)->find();

        return $config;
    }
}   
